Assuming the optical grating in this system can be considered a simple mirror, the equation for simple thin lenses can be applied as follows:
1/OD + 1/ID = 1/FL
where OD is the object distance, and
ID is the image distance, and
FL is the focal length of the lens.
The object distance would be the distance from the slit to the lens (the sum of the slit to the grating plus the grating to the lens). The image distance would be the distance from the lens to the camera sensing chip. The focal length of the lens, in meters, is the reciprocal of the magnification indicated on the lens. The +4 lens of the close-up lens set (the one I used) has a focal length of 1/4 meter, which is 25 cm (about 10 inches) and the distance from the grating to lens is 26 cm (about 10 inches). Applying the measurements of my device (see below), it works out that the lens placement is consistent with the above equation for simple lenses.
For my device, the distance from the slit to the grating is 70 cm (about 27.5 inches) and, as stated above, the distance from the grating to the lens is 26 cm (about 10 inches), so the total image distance is the sum of these two, or 96 cm (about 37.5 inches). On my device, the distance from the lens to the chip of the camera, (which should be variable to achieve and adjust a focus) is about 34 cm (about 13.5 inches). The extension tubes and the extension bellows should allow the camera sensing chip to be both a little closer and somewhat farther than this value.
Can this device be made smaller and still work? The thin lens equation would imply that the shortest possible dimensions of the device would be 4 times the focal length of whatever lens is used. The lens in that circumstance would be placed equidistant to the summed slit distance on the input end and the camera sensing chip on the output end. This equidistant placement might not be possible to achieve, given the constraints of the actual plastic pipes that are used and the necessity to install the grating at the vertex of the two oblique pipes. Thus, the minimum size for the solar spectrograph equipment, using the lenses of a standard four lens close-up lens set, has yet to be determined.
The sun and moon occupy an area of the sky, but a star is a point source of light because of its extreme distance. Applying the equation for simple thin lenses to stars, the object distance (OD) can be considered infinity, so the term 1/OD in the equation becomes zero and this whole term drops from the equation. This leaves 1/ID = 1/FL, or ID = FL. Thus, for stars, which do not need a slit in the apparatus, the focus (the image distance) will be achieved at one focal length from the lens. Planets are not points of light, but are small enough in the nighttime sky to be optically unresolved for unaided human vision. Given the crude construction of the apparatus, planets can probably be imaged as though they were stars, so the spectrum of planets can probably be successfully imaged without a slit and at a focus that is located one focal length from the lens.